import request from "@/utils/request";
enum API {
  // 获取菜单列表的接口地址
  MENULIST_URL = "/admin/acl/permission",
  // 新增菜单的接口地址
  ADDMENU_URL = "/admin/acl/permission/save",
  // 修改菜单的接口地址
  UPDATEMENU_URL = "/admin/acl/permission/update",
  // 删除菜单的接口地址
  REMOVEMENU_URL = "/admin/acl/permission/remove/",
}
// 获取菜单列表的接口
export const reqMenuList = () => request.get<any, any>(API.MENULIST_URL);
// 新增和修改菜单的接口
export const reqAddOrUpdateMenu = (data: any) => {
  if (data.id) {
    return request.put(API.UPDATEMENU_URL, data);
  } else {
    return request.post(API.ADDMENU_URL, data);
  }
};
// 删除菜单的接口
export const reqRemoveMenu = (id: number) =>
  request.delete<any>(API.REMOVEMENU_URL + id);
